package com.hmall.common.client;

import com.hmall.common.dto.Item;
import com.hmall.common.dto.PageDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;



@FeignClient("itemservice")
public interface ItemClient {
    // 获取商品列表
    @GetMapping("/item/list")
    PageDTO<Item> getItemList(
            @RequestParam(defaultValue = "1") int page,
            @RequestParam(defaultValue = "5") int size
    );

    // 根据id查询商品
    @GetMapping("/item/{id}")
    public Item getItemById(@PathVariable Long id);

    // 修改库存
    @PutMapping("/item/{id}/{num}")
    public boolean updateStock(@PathVariable Long id,@PathVariable Integer num);

}
